<?php

class Application_View_Helper_ImageTag {
		
	public function ImageTag($src, $alt = "", $class = "", $id = "") {
		if((string)$src == '') {
			return;
		}
		
		if(strpos($src, 'http://') === false && strpos($src, 'https://') === false) {
			$size = getimagesize (APPLICATION_PATH . '/../' . $src);
		} else {
			$size = getimagesize($src);
		}
		$return  = '<img src="' . $src . '" ' . $size[3] . ' alt="' . $alt . '"';
		
		if($class != "") {
			$return .= ' class="' . $class . '"';
		}
		if($id != "") {
			$return .= ' id="' . $id . '"';
		}
		
		$return .= ' />';
		
		return $return;
	}
}